During both video image encoding and video image decoding, prediction units obtained by dividing an image block need to be predicted. During a prediction, available prediction modes are usually preset for prediction blocks according to sizes of the prediction blocks, which results in different numbers of available prediction modes for prediction blocks of different sizes during video encoding. As shown in Table 1, when the size of a prediction block is 4×4, an intra-frame prediction mode (CurrMode) is selected from prediction modes 0-17; when the size of the prediction block is 8×8, 16×16 or 32×32, a current intra-frame prediction mode is selected from prediction modes 0-35; and for a 64×64 prediction block, an intra-frame prediction mode can only be selected from prediction modes 0-3.
TABLE 1Numbers of prediction modes for predictionblocks of different sizes(Block size)Number of prediction modes2(4 × 4)183(8 × 8)354(16 × 16)355(32 × 32)356(64 × 64)4
In an encoding process, after a current intra-frame prediction mode of a prediction block is determined, an encoding scheme (for example, using 5-bit or 4-bit for encoding) for the current intra-frame prediction mode number needs to be further determined according to the size of the prediction block. In a decoding process, specific logic is also defined to determine the number of bits occupied by information of the current intra-frame prediction mode number in a code stream. This affects the encoding and decoding efficiency.